using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveSystem : LogicSystemBase
{
    protected override void Execute(IEntity entity)
    {
        PlayerComponent playerComponent = entity.GetComponent<PlayerComponent>();
        MoveComponent moveComponent = entity.GetComponent<MoveComponent>();
        moveComponent.ValueChanged = false;
        playerComponent.Transform.position = moveComponent.TargetPos;
    }

    protected override bool ExecuteCondition(IEntity entity)
    {
        return entity.GetComponent<PlayerComponent>().ID == entity.GetComponent<MoveComponent>().ID
            && entity.GetComponent<MoveComponent>().ValueChanged;
    }

    protected override Type[] Listener()
    {
        return new[] { typeof(PlayerComponent), typeof(MoveComponent) };
    }
}
